#ifndef __PROGRAMM_H__
#define __PROGRAMM_H__

#include "globals.h"
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <avr/io.h>
#include <avr/wdt.h>
//#include <avr/boot.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <util/delay.h>
#include <util/crc16.h>

typedef struct _typCPUStats
{
	float threadTime;
} _typCPUStats;

typedef struct _typCPUInfo
{
	struct _typCPUStats mCPUStats;
	uint16_t			nTicks;
	uint32_t			nTicksMS;
} _typCPUInfo;

typedef struct _typAdInput
{
	uint16_t	Raw;		/* Raw Values from read */
	union {
		float	Lookup;		/* Lookup value */
		uint8_t	Bytes[4];	/* Raw Bytes */
	};
	uint8_t		Bits;		/* Bit Resoltuion */
} _typAdInput;

typedef struct _typGlobalData
{
	struct _typAdInput		AdInputs[8];			/* AD Inputs */
	struct _typCPUInfo		mCPUInfo;
	unsigned char			nConsultClks;
	unsigned char			nConsultClksTmp;
} _typGlobalData;

void comm_usb_handler(volatile unsigned char* buffer, unsigned short nLength);

#endif
